package Hot100.Tree;

import java.util.LinkedList;
import java.util.Queue;

public class maxDepth {
    public static void main(String[] args) {
        int[] value = {1,-1,2,3};
        BinaryTree binaryTree = new BinaryTree();
        binaryTree.insert(value);
        maxDepth maxDepth = new maxDepth();
        System.out.println(maxDepth.maxDepth(binaryTree.root));
    }
    int  max = 0;
    public int maxDepth(TreeNode root) {
        if(root == null)
            return 0;
        int depth = 1;
        inorder(root,depth);
        return max;
    }
    public void inorder(TreeNode root ,int depth){
        if(root == null)
            return;
        if(depth > max)
            max = depth;
        inorder(root.left,depth+1);
        inorder(root.right,depth+1);
    }
}
